import { Module } from '@nestjs/common'
import { AuthModule } from './auth/auth.module'
import { UserModule } from './user/user.module'
import { CommonModule } from './common/common.module'
import { JwtModule } from './jwt/jwt.module'
import { ArticelModule } from './articel/articel.module'
import { AdminModule } from './admin/admin.module'
import { CategoryModule } from './category/category.module'
import { CommontModule } from './commont/commont.module'
import { UploadModule } from './upload/upload.module'
import { SvgCaptchaModule } from './svg-captcha/svg-captcha.module'
import { SupportModule } from './support/support.module'
import { ThrottlerGuard, ThrottlerModule } from '@nestjs/throttler'
import { APP_GUARD } from '@nestjs/core'
import { StarModule } from './star/star.module'
import { SearchModule } from './search/search.module'
import { RedisModule } from './redis/redis.module'

@Module({
   imports: [
      AuthModule,
      UserModule,
      CommonModule,
      JwtModule,
      ArticelModule,
      AdminModule,
      CategoryModule,
      CommontModule,
      UploadModule,
      SvgCaptchaModule,
      SupportModule,
      ThrottlerModule.forRoot([
         {
            ttl: 60000,
            limit: 20
         }
      ]),
      StarModule,
      SearchModule,
      RedisModule
   ],
   controllers: [],
   providers: [
      {
         provide: APP_GUARD,
         useClass: ThrottlerGuard
      }
   ]
})
export class AppModule {}
